package createThread;

class runnableTest implements Runnable{

    @Override
    public void run() {
        int i = 0;
        while (i++<5){
            System.out.println(Thread.currentThread().getName()
                    +"的run()方法正在执行！");
        }
    }
}

public class runnableThread {

    public static void main(String[] args) {

        // 创建runnableTest的实例对象
        runnableTest runnable = new runnableTest();
        // 使用Thread的构造方法创建线程对象
        Thread thread1 = new Thread(runnable,"thread1");
        // 调用start方法
        thread1.start();

        // 创建另一个线程
        Thread thread2 = new Thread(runnable,"thread2");
        thread2.start();
    }

}
